using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableSkillDao:DaoBase<TableSkill>
    {
        public override void AddPrimaryIndex(TableSkill model)
        {
            cachePrimary[model.SkillId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableSkill.txt";
        }

        protected override TableSkill ParseRowData(string[] rowData)
        {
            TableSkill data = new TableSkill();
			data.SkillId = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.SkillClass = 0;
            }
            else
            {
                data.SkillClass = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.LevelGrowFactor = 0;
            }
            else
            {
                data.LevelGrowFactor = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.IsUltimate = 0;
            }
            else
            {
                data.IsUltimate = int.Parse(rowData[3]);
            }
			data.AniName = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.Duration = 0;
            }
            else
            {
                data.Duration = double.Parse(rowData[5]);
            }
			data.SkillIcon = rowData [6];
			data.SkillAudio = rowData [7];
			data.Effect0 = rowData [8];
			data.EffBone0 = rowData [9];
			data.Effect1 = rowData [10];
			data.EffBone1 = rowData [11];
			data.Effect2 = rowData [12];
			data.EffBone2 = rowData [13];
			data.Effect3 = rowData [14];
			data.EffBone3 = rowData [15];
			data.Effect4 = rowData [16];
			data.EffBone4 = rowData [17];

            if (string.IsNullOrEmpty(rowData[18]))
            {
                data.SkillCastPointSelectRule = 0;
            }
            else
            {
                data.SkillCastPointSelectRule = int.Parse(rowData[18]);
            }

            if (string.IsNullOrEmpty(rowData[19]))
            {
                data.SCPSelectArgs = 0;
            }
            else
            {
                data.SCPSelectArgs = double.Parse(rowData[19]);
            }

            if (string.IsNullOrEmpty(rowData[20]))
            {
                data.CameraRule = 0;
            }
            else
            {
                data.CameraRule = int.Parse(rowData[20]);
            }

            if (string.IsNullOrEmpty(rowData[21]))
            {
                data.SkillFirstTargetSelectStrategy = 0;
            }
            else
            {
                data.SkillFirstTargetSelectStrategy = int.Parse(rowData[21]);
            }

            return data;
        }



    }

}
